<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>填写任务</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../layui/css/layui.css">
  <link rel="stylesheet" href="../layui/css/lxq.css">
	<script type="text/javascript" src="<%=path %>/layui/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../layui/layui.js" charset="utf-8"></script>
</head>
<body>
<div class="lxq-body">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>填写任务</legend>
</fieldset>
 <form class="layui-form"  method="post" id="data_form">
  <div class="layui-row layui-col-space10">
	<input name="id" type="hidden" value="${form.id }"/>	
	<input name="dataMap.id" type="hidden" value="${dataEntity.id }"/>	
	<s:iterator value="topicList" var="topic" status="t">
	<c:set var="key" value="key${topic.id }"/>
		<c:choose>
			<c:when test="${topic.topicType == 1}">		
				<div class="layui-form-item">
				    <label class="layui-form-label">${topic.topicName }</label>
				    <div class="layui-input-block">
				      <input type="text" name="dataMap.data${topic.id}" required  lay-verify="required" placeholder="请输入${topic.topicName }" value="" autocomplete="off" class="layui-input">
				    </div>
			  	</div>
		  </c:when>
			<c:when test="${topic.topicType == 2}">
			  <div class="layui-form-item layui-form-text">
			    <label class="layui-form-label">${topic.topicName }</label>
			    <div class="layui-input-block">
			      <textarea name="dataMap.data${topic.id}" placeholder="请输入请输入${topic.topicName }" class="layui-textarea"></textarea>
			    </div>
			  </div>
			</c:when>
			<c:when test="${topic.topicType == 3}">
			  <div class="layui-form-item">
			    <label class="layui-form-label">${topic.topicName }</label>
			    <div class="layui-input-block">
			    <c:forEach items="${optionMap[key]}" var="option">
			    	<input type="radio" name="dataMap.data${topic.id}" value="${option }" title="${option }" >
				</c:forEach>
			    </div>
			  </div>
			</c:when>
			<c:when test="${topic.topicType == 4}">
			  <div class="layui-form-item">
			    <label class="layui-form-label">${topic.topicName }</label>
			    <div class="layui-input-block">
			    	<c:forEach items="${optionMap[key]}" var="option" varStatus="o">
			    	<c:set var="string1" value="${dataEntity.datas[t.index] }"/>
					<c:set var="string2" value="${option }"/>
			    		<input type="checkbox" name="dataMap.data${topic.id}_${o.index}" value="${option }" title="${option }" >
			    	</c:forEach>
			    </div>
			  </div>
			</c:when>
		
		</c:choose>
	

	
	</s:iterator>	

	
		  
		  
	    <div class="layui-form-item">
		    <div class="layui-input-block">
		    <button class="layui-btn" lay-submit lay-filter="submit">提交</button> 
		    </div>
		  </div>
		

    
    
  
  </div>    
          
</form>
 </div>
<script>
layui.use(['form'], function(){
  var form = layui.form;
  var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  
  form.on('submit(submit)', function(data){
		$.ajax({
			type:"POST",
			url:"<%=basePath%>/biz/Writer_edit",
			data:data.field,
			success:function(data){
				 parent.layer.close(index); //再执行关闭
			}
		});
	  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	});
});
</script>

</body>
</html>